<template>
  <div>
    <CategoryList :isCheckSelect="scene !== 1"></CategoryList>

    <!-- 三个子组件 -->
    <el-card style="margin: 10px 0px">
      <SpuList
        v-if="scene == 1"
        @changeScene="saveScene"
        @getSpuInfo="saveSpuInfo"
      ></SpuList>
      <SpuForm
        v-if="scene == 2"
        @changeScene="saveScene"
        :currentSpiInfo="currentSpiInfo"
      ></SpuForm>
      <SkuForm
        v-if="scene == 3"
        :currentSpuInfo="currentSpiInfo"
        @changeScene="saveScene"
      ></SkuForm
    ></el-card>
  </div>
</template>

<script lang="ts">
import CategoryList from "@/components/CategoryList"
import SpuList from "./components/SpuList.vue"
import SpuForm from "./components/SpuForm.vue"
import SkuForm from "./components/SkuForm.vue"
export default {
  name: "Spu",
  components: { CategoryList, SpuList, SpuForm, SkuForm },
}
</script>

<script lang="ts" setup>
import { ref } from "vue"

const scene = ref(1)
const currentSpiInfo = ref()

const saveScene = (val: number) => {
  scene.value = val
}

const saveSpuInfo = spuInfo => {
  currentSpiInfo.value = spuInfo
}
</script>

<style></style>
